#ifndef GRAPHICS_H
#define GRAPHICS_H

#include "def.h"
#include "cmus-rg.h"
#include "parser.h"
#include "input.h"
#include "commands.h"

void init_graphics(cr_state *state, char *font, int max_w, int max_h, int font_size);
void init_buttons(cr_button_node **root, cr_button_node **tail);
void cleanup_graphics(SDL_Window **window, SDL_Renderer **renderer, TTF_Font **font);

void set_render_change(bool *render_change);
void pre_render(SDL_Renderer **renderer, SDL_Texture **display);
void render(SDL_Renderer **renderer, SDL_Texture **display, bool *render_change, cr_drawable *drawables, cr_drawable *drawextras, cr_button_node *root);

void register_cr_drawable(cr_drawable *drawable, cr_drawable d, bool *render_change);
void update_cr_drawable_rect(cr_drawable *drawable, SDL_Rect *rect);
void destroy_cr_drawable(cr_drawable *drawable);

cr_drawable empty_drawable();
cr_drawable drawable_text(SDL_Renderer **renderer, TTF_Font **font, int x, int y, int max_w, int max_h, char *text, uint32_t color);
cr_drawable drawable_cover_art(SDL_Renderer *renderer, unsigned char *image, int image_size, int max_w, int max_h);
cr_drawable drawable_bg_rect(SDL_Renderer **renderer, SDL_Rect rect, uint32_t color);

#endif